home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 19 / Mac Magazin and MacEasy Magazine CD - Issue 19.iso / Grafik & Text & Film / Quark XTensions / Freeware Xtensions / XPress Scripts 1.0 / Grid Maker / Grid Maker next >
Text File  |  1994-08-10  |  4KB  |  106 lines

  1. tell application "QuarkXPress 3.3"
  2.     activate
  3.     if document 1 exists then
  4.         copy tool mode of document 1 to toolMode
  5.         set tool mode of document 1 to drag mode
  6.         copy selection of document 1 to x
  7.         tell current page of document 1
  8.             
  9.             copy (count of (generic boxes whose selected is true)) to numSelected
  10.             if numSelected = 0 then
  11.                 beep
  12.                 display dialog "Check a box is selected and" & return & "that it is on the current page." buttons "OK" default button 1 with icon 1
  13.                 do updates
  14.             else if numSelected is not 1 then
  15.                 beep
  16.                 display dialog "" & numSelected & " items have been selected." & return & "(Only one box can be used at a time)." buttons "OK" default button 1 with icon 2
  17.                 do updates
  18.             else if (box type of generic boxes whose selected is true) = line box then
  19.                 beep
  20.                 display dialog "Cannot use lines." buttons "OK" default button 1 with icon 2
  21.                 do updates
  22.             else
  23.                 copy bounds of x as list to boxBounds
  24.                 copy item 1 of boxBounds as real to bounds1
  25.                 copy item 2 of boxBounds as real to bounds2
  26.                 copy item 3 of boxBounds as real to bounds3
  27.                 copy item 4 of boxBounds as real to bounds4
  28.                 
  29.                 copy item 1 of boxBounds as real to c
  30.                 copy (round c rounding down) to bounds1Intd
  31.                 copy c - (round bounds1Intd rounding down) to e
  32.                 copy e * 100 to f
  33.                 copy (round f rounding down) to bounds1Intg
  34.                 copy item 2 of boxBounds as real to c
  35.                 copy (round c rounding down) to bounds2Intd
  36.                 copy c - (round bounds2Intd rounding down) to e
  37.                 copy e * 100 to f
  38.                 copy (round f rounding down) to bounds2Intg
  39.                 copy item 3 of boxBounds as real to c
  40.                 copy (round c rounding down) to bounds3Intd
  41.                 copy c - (round bounds3Intd rounding down) to e
  42.                 copy e * 100 to f
  43.                 copy (round f rounding down) to bounds3Intg
  44.                 copy item 4 of boxBounds as real to c
  45.                 copy (round c rounding down) to bounds4Intd
  46.                 copy c - (round bounds4Intd rounding down) to e
  47.                 copy e * 100 to f
  48.                 copy (round f rounding down) to bounds4Intg
  49.                 
  50.                 copy (display dialog "GridMaker:" & return & "Horizontal range: '" & bounds1Intd & ¬
  51.                     "." & bounds1Intg & "' to '" & bounds3Intd & "." & bounds3Intg & "'" default answer "" buttons {"Cancel", "Horizontal"} default button 2 with icon 2000) to x
  52.                 do updates
  53.                 if button returned of x is "Horizontal" then
  54.                     try
  55.                         copy text returned of x to y
  56.                         copy every character of y as list to y
  57.                         
  58.                         repeat with i from 1 to count of items in y
  59.                             if item i of y = "," then
  60.                                 set item i of y to " "
  61.                             end if
  62.                         end repeat
  63.                         copy y as text to y
  64.                         repeat with i from 1 to count of words in y
  65.                             copy word i of y to linePosition
  66.                             make line box at beginning with properties {left point:{linePosition, bounds2}, right point:{linePosition, bounds4}}
  67.                         end repeat
  68.                     on error errMsg
  69.                         beep
  70.                         display dialog "Invalid entry. ‘" & y & "’ cannot be used." & return & return & " " buttons {"  Okay  "} default button 1 with icon 2
  71.                         do updates
  72.                     end try
  73.                 end if
  74.                 copy (display dialog "GridMaker:" & return & "Vertical range: '" & bounds2Intd & ¬
  75.                     "." & bounds2Intg & "' to '" & bounds4Intd & "." & bounds4Intg & "'" default answer "" buttons {"Cancel", "  Vertical  "} default button 2 with icon 2000) to x
  76.                 do updates
  77.                 if button returned of x is "  Vertical  " then
  78.                     try
  79.                         copy text returned of x to y
  80.                         copy every character of y as list to y
  81.                         
  82.                         repeat with i from 1 to count of items in y
  83.                             if item i of y = "," then
  84.                                 set item i of y to " "
  85.                             end if
  86.                         end repeat
  87.                         copy y as text to y
  88.                         repeat with i from 1 to count of words in y
  89.                             copy word i of y to linePosition
  90.                             make line box at beginning with properties {left point:{bounds1, linePosition}, right point:{bounds3, linePosition}}
  91.                         end repeat
  92.                     on error errMsg
  93.                         beep
  94.                         display dialog "Invalid entry. '" & y & "' cannot be used." & return & return & " " buttons {"  Okay  "} default button 1 with icon 2
  95.                         do updates
  96.                     end try
  97.                 end if
  98.             end if
  99.         end tell
  100.         set tool mode of document 1 to toolMode
  101.     else
  102.         beep
  103.         display dialog "This script requires an" & return & "open QuarkXPress document." buttons "OK" default button 1 with icon 1
  104.         do updates
  105.     end if
  106. end tell